package com.weijian.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;

@Mapper
public interface ReportMapper {

    @Select("select od.name name, sum(od.num) number " +
            "from order_detail od, order_table o " +
            "where od.order_id = o.id " +
            "and o.pay_time > #{begin} and o.pay_time < #{end} " +
            "group by name order by number desc")
    List<HashMap<String, Object>> salesTop10Report(@Param("begin") LocalDateTime begin, @Param("end") LocalDateTime end);

}
